package com.xin.controller;

import com.xin.pojo.User;
import org.junit.runners.Parameterized;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;


/**
 * @author WYX
 * @create 2020-04-03-8:28
 */
@Controller
@RequestMapping("user")
public class UserController {


    @RequestMapping("/t1")
    public String test1(@RequestParam("username") String name, Model model){
        //1、接受前端参数
        System.out.println("接受前端参数为："+name);
        //2、将返回的结果传递给前端，Model
        model.addAttribute("msg",name);
        //3、视图跳转
        return "test";
    }

    //前端接收的是一个对象
    @RequestMapping("/t2")
    public String test2(User user){

        System.out.println(user);
        return "test";
    }
}
